package com.sniper.mybatis.service.impl;

import com.sniper.datasource.DataSource;
import com.sniper.datasource.DataSourceValue;
import com.sniper.model.AdminUser;
import com.sniper.mybatis.service.BaseService;

import java.util.List;

public interface AdminUserService extends BaseService<AdminUser> {

    @DataSource(DataSourceValue.SLAVE)
    AdminUser validateByName(String username);

    @DataSource(DataSourceValue.SLAVE)
    AdminUser getUserAndGroupAndRight(String username);

    @DataSource(DataSourceValue.SLAVE)
    AdminUser validateByNickName(String username);

    @DataSource(DataSourceValue.SLAVE)
    AdminUser validateByNickName(String username, String notUser);

    @DataSource(DataSourceValue.SLAVE)
    AdminUser validateByEmail(String email);

    @DataSource(DataSourceValue.SLAVE)
    AdminUser validateByEmail(String email, String notUser);

    @DataSource(DataSourceValue.SLAVE)
    List<AdminUser> listByEmail(String email);

    @DataSource(DataSourceValue.SLAVE)
    boolean validateUser(String name, String password);


    AdminUser register(AdminUser user);

    /**
     * 前台注册用户
     *
     * @param user
     * @param password
     * @return
     */
    AdminUser regUser(AdminUser user, String password);

    @DataSource(DataSourceValue.SLAVE)
    AdminUser getUser(String sourceUid);

    @DataSource
    int changePassword(String username, String passwd);

    @DataSource
    int changePasswordById(String uid, String passwd);

}
